OPC-UA Embedded Server SDK  2.1.0
Security Functions

Functions

UA_Status_t UASecurity_Check_application_certificate_exists (void)
 
UA_Status_t UASecurity_Create_self_signed_certificate (const UA_Configuration_t *sdk_configuration, const char *server_uri, const char **hostnames, int no_of_hostnames, const char **ip_addresses, int no_of_ip_addresses)
 
UA_Status_t UASecurity_Reload_directory_stores_now (void)
 
void UASecurity_Reload_directory_stores_before_each_validation (bool_t enable)
 
UA_Status_t UASecurity_Create_directory_stores (void)
 
void UASecurity_Set_validation_options (uint32_t option_bits)
 
UA_Status_t UASecurity_Get_thumbprint (const char *filepath, char *thumbprint, uint32_t thumbprint_max_length)
 
void UASecurity_Callback_get_private_key_password (UA_Var_string_t *password)
 
void UASecurity_Callback_certificate_added_to_rejected_list (UA_Certificate_Type_t type)
 

Detailed Description

Function Documentation

UA_Status_t UASecurity_Check_application_certificate_exists ( void  )

Check if the application certificate and corresponding private key are present.

If there is no application certificate present the application may choose to create a default self signed certificate if certificate creation functionality is supported by the PKI component.

Returns
OpcUa_Good if the certificate exists.
UA_Status_t UASecurity_Create_self_signed_certificate ( const UA_Configuration_t *  sdk_configuration,
const char *  server_uri,
const char **  hostnames,
int  no_of_hostnames,
const char **  ip_addresses,
int  no_of_ip_addresses 
)

Create a self signed certificate.

Parameters
[in]sdk_configurationThe configuration structure used to initialise the SDK.
[in]server_uriThe server URI.
[in]hostnamesThe array of hostnames assigned to the host that the server is running on that the server is accessible from.
[in]no_of_hostnamesThe number of hostnames.
[in]ip_addressesThe array of ip addresses assigned to the host that the server is running on that the server is accessible from. If hostnames are available IP addresses should not be used.
[in]no_of_ip_addressesThe number of IP addresses.
Returns
OpcUa_Good if the operation succeeds.
UA_Status_t UASecurity_Reload_directory_stores_now ( void  )

Reload the directory certificate stores.

If the PKI component stores certificates in the filesystem it may load the certificates only once on startup. If a certificate is added the application may wish the PKI compnent to reload the stores from the filesystem following the addition.

Returns
OpcUa_Good if the operation succeeds.
void UASecurity_Reload_directory_stores_before_each_validation ( bool_t  enable)

Reload the directory certificate stores before every certificate validation.

If the PKI component stores certificates in the filesystem it may load the certificates only once on startup. If it is possible for certificates to be added or removed from the filesystem at any time and independently of the application the application should instruct the PKI component to reload certificates from the filesystem prior to every validation.

Parameters
[in]enableenable or disable reloading.
UA_Status_t UASecurity_Create_directory_stores ( void  )

Create the directory certificate stores.

Create the filesystem structure required for the certificate stores. There are four certificate stores. There are trusted and issuer stores for both application and user certificates.

Returns
OpcUa_Good if the operation succeeds.
void UASecurity_Set_validation_options ( uint32_t  option_bits)

Alter the behaviour of the certificate validation logic.

Parameters
[in]option_bitsBitmap defining the behaviour required.

The option bits are:

Option Bit - Accept expired certificates OB_SUPPRESS_CERTIFICATE_EXPIRED (1<<0)

Option Bit - Do not validate the application hostname OB_SUPPRESS_HOSTNAME_INVALID (1<<1)

Option Bit - If checking certificate CRLs do not reject a certificate if a CRL for the Issuer cannot be found OB_SUPPRESS_REVOCATION_STATUS_UNKNOWN (1<<2)

Option Bit - Look for CRLs online (not currently supported) OB_CHECK_REVOCATION_STATUS_ONLINE (1<<3)

Option Bit - Look for CRLs locally (typically in the local filesystem OB_CHECK_REVOCATION_STATUS_OFFLINE (1<<4)

Option Bit - Use default options for the PKI provider OB_USE_DEFAULT_OPTIONS (1<<5)

Option Bit - Trust all client certificates if the trust list is empty OB_TRUST_ALL_CLIENTS_WHEN_TRUST_LIST_IS_EMPTY (1U<<31)

Option Bit - Do not save rejected certificates OB_DO_NOT_SAVE_REJECTED_CERTIFICATES (1U<<30)

UA_Status_t UASecurity_Get_thumbprint ( const char *  filepath,
char *  thumbprint,
uint32_t  thumbprint_max_length 
)

Get the certificate thumbprint.

When storing certificates in a filesystem programmatically the SHA1 thumbprint should be used as the filename for the certificate with the .DER file extension. This ensures that all certificates shall have a unique filename. The OpenSSL PKI component does not make use of this file naming convention but other PKI components may depend on it for correct operation.

Returns
OpcUa_Good if the operation succeeds.
void UASecurity_Callback_get_private_key_password ( UA_Var_string_t *  password)

Provide the password for the application certificate private key file.

Where (UA_INCLUDE_ASYNC_OPS is > 0) this callback may be called on different threads. Ensure you provide whatever locking is necessary for your platform when enabling asynchronous operation.

Parameters
[out]passwordThe password for the private key PEM file.
void UASecurity_Callback_certificate_added_to_rejected_list ( UA_Certificate_Type_t  type)

A certificate was added to the rejected certificate list.

Where (UA_INCLUDE_ASYNC_OPS is > 0) this callback may be called on different threads. Ensure you provide whatever locking is necessary for your platform when enabling asynchronous operation.

Parameters
[in]typeThe type of the certificate.